dofile ("StylusBox.lua")
dofile ("libColor.lua")


function initCurseur()

cur = Image.load ("curseur.png", VRAM)

curx=10
cury=10

end

function drawCurseur()

    screen.blit (SCREEN_DOWN, curx, cury, cur)
    if Stylus.held then
      curx = Stylus.X
      cury = Stylus.Y
    end
   
end

function newWindow(nb, scr, x, y, larg, haut, R, V, B)

_G["win_"..nb] = {scr, x, y, larg, haut, coul, R, V, B}

end

function drawWindow(nb)

local arreter = false

if arreter == false then

screen.drawFillRect(_G["win_"..nb.."[1]"], _G["win_"..nb.."[2]"], _G["win_"..nb.."[3]"], _G["win_"..nb.."[2]"]+_G["win_"..nb.."[4]"], _G["win_"..nb.."[3]"]+_G["win_"..nb.."[5]"], Color.new(_G["win_"..nb.."[6]"], _G["win_"..nb.."[7]"], _G["win_"..nb.."[8]"]))
screen.drawFillRect(_G["win_"..nb.."[1]"], _G["win_"..nb.."[2]"], _G["win_"..nb.."[3]"], _G["win_"..nb.."[2]"]+_G["win_"..nb.."[4]"], _G["win_"..nb.."[3]"]+20, Color.invert(_G["win_"..nb.."[6]"], _G["win_"..nb.."[7]"], _G["win_"..nb.."[8]"]))

screen.drawFillRect(_G["win_"..nb.."[1]"], _G["win_"..nb.."[2]"]+_G["win_"..nb.."[4]"]-15, _G["win_"..nb.."[3]"]+5, _G["win_"..nb.."[2]"]+_G["win_"..nb.."[4]"]-5, _G["win_"..nb.."[3]"]+15, Color.new(31, 0, 0))

screen.drawLine(_G["win_"..nb.."[1]"], _G["win_"..nb.."[2]"]+_G["win_"..nb.."[4]"]-14, _G["win_"..nb.."[3]"]+6, _G["win_"..nb.."[2]"]+_G["win_"..nb.."[4]"]-6, _G["win_"..nb.."[3]"]+14, Color.new(31, 31, 31))
screen.drawLine(_G["win_"..nb.."[1]"], _G["win_"..nb.."[2]"]+_G["win_"..nb.."[4]"]-6, _G["win_"..nb.."[3]"]+6, _G["win_"..nb.."[2]"]+_G["win_"..nb.."[4]"]-14, _G["win_"..nb.."[3]"]+14, Color.new(31, 31, 31))

local croix = newBox(_G["win_"..nb.."[2]"]+_G["win_"..nb.."[4]"]-15, _G["win_"..nb.."[3]"]+5, _G["win_"..nb.."[2]"]+_G["win_"..nb.."[4]"]-5, _G["win_"..nb.."[3]"]+15)

if Stylus.held then

StyX = Stylus.X
StyY = Stylus.Y

if Stylus.heldinBox(croix, StyX, StyY) then

local arreter = true

end

end

end

end

function delWindow(nb)

_G["win_"..nb..""] = nil

end

function delCurseur()

Image.destroy(cur)
cur = nil
curx = nil
cury = nil

end
